
package com.mbbmap.app.exception;

/**
 * @author Lue
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class LogonException extends Exception {

    // Logon error code constants
    public static short INVALID_USER_ID = 1;
    public static short INVALID_USER_PWD = 2;
    public static short USER_DISABLED = 3;
    public static short USER_LOCKED = 4;
    public static short IMPROPER_LOGOUT = 5;
    public static short TOO_MANY_BAD_ATTEMPTS = 6;
    public static short CHANGE_PWD = 7;
    public static short CHANGE_PWD_EXP = 8;
    public static short CHANGE_PWD_FIRST_LOGON = 9;
    public static short INACTIVE_USER = 10;
    public static short NEW_PWD_EXIST = 11;
    public static short NO_ACCESS_DATE = 12;
    public static short USER_STATUS_NOT_APPROVED = 13;
    public static short USER_ID_PWD_SAME = 14;
    
    private static String DEFAULT_MSG = "Logon Error Code = ";
    
    // Logon error code
    public short errCode = 0;
    
	public LogonException(short errorCode, String message) {
		super(message + "\n" + DEFAULT_MSG + errorCode);
		this.errCode = errorCode;
	}
	
	public LogonException(short errorCode) {
		super(DEFAULT_MSG + errorCode);
		this.errCode = errorCode;
	}
	
	public short getErrorCode() {
	    return errCode;
	}

}
